package com.inhim.pjhim.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.inhim.pjhim.R;
import com.inhim.pjhim.entity.ReaderTypeList;
import com.inhim.pjhim.utils.ImageLoaderUtils;
import com.inhim.pjhim.view.CircleImageView;

import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
import org.yczbj.ycrefreshviewlib.holder.BaseViewHolder;

public class ChapterAdapter extends RecyclerArrayAdapter<ReaderTypeList.List> {

    public ChapterAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new PersonViewHolder(parent);
    }
    public class PersonViewHolder extends BaseViewHolder<ReaderTypeList.List> {

        CircleImageView circleImageView;
        TextView textview;
        PersonViewHolder(ViewGroup parent){
            super(parent, R.layout.item_chapter_list);
            circleImageView =getView(R.id.circleImageView);
            textview = getView(R.id.textview);
        }
        @Override
        public void setData(ReaderTypeList.List data) {
            super.setData(data);
            ImageLoaderUtils.setImage(data.getIcon(), circleImageView);
            textview.setText(data.getName());
        }
    }
}
